#ifndef FORMATMODEL_H
#define FORMATMODEL_H

#include <QAbstractItemModel>
#include "formatitem.h"

class FormatModel : public QAbstractItemModel
{
    Q_OBJECT

public:
    explicit FormatModel(QString file, QObject* parent = nullptr);

    ~FormatModel();

    QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;

    QModelIndex parent(const QModelIndex& index) const override;

    int rowCount(const QModelIndex& parent = QModelIndex()) const override;

    int columnCount(const QModelIndex& parent = QModelIndex()) const override;

    QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;

public slots:
    void showItem(const QModelIndex &index);

private:
    FormatItem* getItem(const QModelIndex& index) const;
    FormatItem* root_item_;
    FEBuffer *top_buffer_;
};

#endif // FORMATMODEL_H
